
#ifndef __ALGO_H__
#define __ALGO_H__

struct algo_t
{
    unsigned int load_address;
    unsigned int load_address64;
    unsigned char *instructions;
    unsigned int algo_sz;

    unsigned int dev_start_adr;
    unsigned int dev_start_adr64;
    unsigned int dev_sz;
    unsigned int dev_page_sz;

    unsigned int pc_Init;
    unsigned int pc_Init64;
    unsigned int pc_UnInit;
    unsigned int pc_UnInit64;
    unsigned int pc_EraseSector;
    unsigned int pc_EraseSector64;
    unsigned int pc_ProgramPage;
    unsigned int pc_ProgramPage64;
    unsigned int pc_Verify;
    unsigned int pc_Verify64;
    unsigned int pc_EraseChip;
    unsigned int pc_EraseChip64;
    unsigned int pc_BlankCheck;
    unsigned int pc_BlankCheck64;
    unsigned int pc_Read;
    unsigned int pc_Read64;

    unsigned int static_base;
    unsigned int static_base64;
    unsigned int begin_data;
    unsigned int begin_data64;
    unsigned int begin_stack;
    unsigned int begin_stack64;

    struct
    {
        unsigned int sector_sz;  /*!< Sector Size in Bytes */
        unsigned int sector_adr; /*!< Address of Sector */
    } sector[16];
};

typedef struct 
{ 
    unsigned int idcode;
    unsigned char name[128];
    struct algo_t *algo;
} flash_algo_t;

extern const flash_algo_t algo[];

#endif
